Executing a layout

Hello,

I am new to dxl and still learning. To practice I created a layout column that displayed the position of the object in the module as a number.

For example, the first object should have a display of "Object Number: 1", the second "Object Number: 2" and so on.

The problem is that when the info is displayed in the column, it seems that the layout is executed twice per object.

I created an attribute in the module ("count") that is an integer and I use it in the layout to save the position of each object.

The code I wrote is the following:

 

Module m = current
int a = m."count"
a++
display "Object Number: " a ""
m."count"= a

 

The problema is that I get the following:

Object Number: 2

Object Number: 4

Object Number: 6

...

 

I don't know why but it seems that every layout in the column is executing twice so the value saved in the attribute count is incrementing two times.

 

Is there any way to solve this? Can somebody tell me if I am doing something wrong?

 

Thank you,

 

Kind regards

 

 


dxl_learner - Tue Jun 07 07:12:04 EDT 2016

Re: Executing a layout
DOORSHAM - Tue Jun 07 07:37:06 EDT 2016

Layout dxl executes multiple time whenever the environment changes.

Unless you are very skilled with layoutdxl you shouldn't be updating an attribute with layoutdxl.

 

Re: Executing a layout
dxl_learner - Thu Jun 09 02:23:10 EDT 2016

Thanks for your answer DOORSHAM,

 

I am very interested in implementing a counter because I would like to enumerate all the objects and, in the future, I might need to sabe the values in an attribute.

So how could I implement a counter in the layout column for all the objects?

 

Thanks again!

Re: Executing a layout
DOORSHAM - Thu Jun 09 03:39:00 EDT 2016

dxl_learner - Thu Jun 09 02:23:10 EDT 2016

Thanks for your answer DOORSHAM,

 

I am very interested in implementing a counter because I would like to enumerate all the objects and, in the future, I might need to sabe the values in an attribute.

So how could I implement a counter in the layout column for all the objects?

 

Thanks again!

The country I live in has laws about contributing to others  -- so I can't help you. Perhaps someone else will.  My suggestion is to do your count with regular dxl or some alternate approach.